Hello Dom,

On 6/26/21 3:09 AM, Dom Masters wrote:
> Hello Frank, how are you doing?

thanks, I'm fine - had my first shot of Biontech/Pfizer last week (finally).

How are you?

> I've spent over 400 hours working on Chess.

Wow, that's a lot!

I haven't worked a lot on Chess, I'm afraid. The todos which kept me from doing it are mostly done now (taxes, etc), but now my mother in law is terminally ill and we visit her more often.


> The new version is massively better, but I am stuck on two things.
> Firstly what does using the setLevel function with the first variable as -1 mean?

SetLevel (in pocket_interface.h) can be used to set the thinking time of a normal level or an Elo-level.

void SetLevel( int nMoves, int nSeconds, int nIncrement, int nDepth)

For Elo-Levels, a negative nMoves argument gives the Elo-Level number (e.g. 1,..,100 ==> nMoves = -1,..,-100).


> Also how can I get the analysis in grandmaster to analyse at say ELO 50 level even tho' the player has it set at say 1?

That's similar to one of the issues I also noticed: if the player sets an easy level, Hint-moves are computed using that level (instead of a strong level).

I don't have your exact code here, but basically it should work like this:

- call SetLevel(-50, ...) // or some normal level
- call StartAnalyse()
- reset level by SetLevel(-1 /*or some other level*/)


In more detail:

1. Depending on the arguments, SetLevel(...) calls one of the engine's SetXX()-methods, e.g. pEngine->SetInfinite() or pEngine->SetElo().
For Elo-levels, SetLevel(-x, ...) calls
        pEngine->SetElo(-(-x) /*== +x == elo level #x*/); which calls
    poSearch->setWeak(scWeak);
so the engine knows whether it should use a "weak"-level or not.


2. MainView.mm calls StartAnalyse(mode), which calls
void CGromitEngine::Analyse(int mode)   // 0: normal, !=0: ponder
Analyse() prepares a search by calling ComputeTimeLimits() and then starts the search via.
    poSearch->search(this, poBoard, poEvaluation, poHashtable,
                     oMove, scScore);

3. CGSearch::search() looks at the scWeak variable to decide if it should run a normal search or a limited-strength search:
    bBeginnerEngine = (scWeak > 0);
For normal searches, it uses the parameters computed by ComputeTimeLimits().


Important note: I fixed a bug in the code I sent, which might still be in your version: CGSearch::setWeak() sets the variable CGSearch::scWeak.
But (bug) this variable was never re-set to 0 in subsequent calls to SetLevel(). E.g. when SetLevel() calls void CGromitEngine::SetInfinite(), SetInfinite() should reset scWeak. My fixed version looks like this:

void CGromitEngine::SetInfinite()
{
    std::cout << "SetInfinite()" << std::endl;
    nMovesleft      = 1;
    nSecondsleft    = 999999;
    nIncrement      = 0;
    nMaxSearchdepth = MAXDEPTH;
    bInfinite       = true;
    nFixedNodes     = 0;
    nElo            = 0;  //FRANK377
    poSearch->setWeak(0); //FRANK377 reset scWeak in gsearch.cpp }

and

void CGSearch::setWeak(GScore value)
{
    if( value > 0 )
        scWeak = value;
    else
        scWeak = 0;
}




> I don't want to mess up and break anything :). Some of the issues I have found are due to deprecated code eg screen rotation.
Ok.

> Do you still have an iPhone or an iPad?

I have the old iPad 1, which still works but doesn't update anymore.
Good quality hardware, really!
Also, the Macbook still works fine and I update it when updates become available. But I don't have a new iPhone or iPad.


> Would love to get feedback off you when I am ready.
> Hoping to have it work on Mac too but a few spanners currently in the works there.
Ok, great!

Best
Frank

